﻿using GeneralServices.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WpfApplication1.TestValid
{
    public class FactoryDTOTypeTask : AbstractFactoryDTO
    {
        public FactoryDTOTypeTask()
        {
        }

        public override object CreateBean(IDTO dto)
        {
            if (dto is DTOTypeTask)
            {
                PLAN_TYPE_TASK type = new PLAN_TYPE_TASK();
                type.Id = (dto as DTOTypeTask).Id;
                type.Libelle = (dto as DTOTypeTask).Libelle;
                type.R = (dto as DTOTypeTask).R;
                type.G = (dto as DTOTypeTask).G;
                type.B = (dto as DTOTypeTask).B;
                return type;
            }
            else return null;
        }

        public override IDTO CreateDTO(object o)
        {
            if (o is PLAN_TYPE_TASK)
            {
                DTOTypeTask type = new DTOTypeTask();
                type.Id = (o as PLAN_TYPE_TASK).Id;
                type.Libelle = (o as PLAN_TYPE_TASK).Libelle;
                type.R = (o as PLAN_TYPE_TASK).R;
                type.G = (o as PLAN_TYPE_TASK).G;
                type.B = (o as PLAN_TYPE_TASK).B;
                return type;
            }
            else return null;
        }
    }
}
